package genome;


import java.util.Random;
 

public class Constant {
	Integer cst;
	public Constant (String currentLine){
		cst = Integer.parseInt(currentLine.substring(0,
				currentLine.indexOf(";")));
	}
	
	public String toString(){
		return ""+cst;
	}
	
	public int getValue(){
		return cst;
	}
	
	public Constant(){
		cst = (int) (ParametersRandomGen.constant_max * Math.random());
	}
	
	public Constant(int i){
		cst = i;
	}
	
	public void mutate(){
		// mutation of the constant gives a constant following a gaussian distribution
		//centered in old constant and with "ecart type" the old constant
		// (usually a number between 0 and 2*old constant
		// can be negative
		// is an integer
		
		cst+= (int)(new Random().nextGaussian()
				*cst);
	}
}
